package com.yuhs.zixing.study.design.pattern.dp002.structural.s001.adapter.a001;

/**
 * @description: 电压适配器
 * @author: yuhs
 * @date: 2022/5/1 5:38 PM
 */
public class VoltageAdapter001 implements Voltage5V001{

    private Voltage220V001 voltage220V001;


    public VoltageAdapter001(Voltage220V001 voltage220V001) {
        this.voltage220V001 = voltage220V001;
    }

    /**
     * 输出5V
     */
    @Override
    public int output5V() {
        int dest = 0;
        if (null!=voltage220V001){
            final int src = voltage220V001.output220V();
            System.out.println("使用适配器适配电压");
            dest = src/44;
            System.out.println("适配完成 电压为" + dest);

        }
        return dest;
    }
}
